/*! \file motor2.cpp

\brief DC motor model number 1

Date of creation: 2010-15-11

Copyright
Julian David Colorado, jd.colorado@upm.es
Universidad Politecnica de Madrid

See the file "license.terms" for information on usage and redistribution of this file, and for a
DISCLAIMER OF ALL WARRANTIES.
*/


/*
INPUT
\param MAT SimParam: Simulation Parameters 4 x 6
\param double u: Control action
\param int i: Time flag

OUTPUT
\param double X: control action

*/

#include "../../dynlib.h"
double dcmotors(Matrix &SimParam,double u,Matrix &X,int i)
{
	/*motor2(Km,Kg,R,r,u,ve):
	R=SimParam[1,0]
	r=SimParam[1,1]
	Km=SimParam[1,2]
	Kg=SimParam[1,3]*/
	//(Km*Kg*u/R*r)-(Km^2*Kg^2*vel/R*r^2)

	return ((SimParam(2,3)*SimParam(2,4)*u) / (SimParam(2,1)*SimParam(2,2)) -((SimParam(2,3)*SimParam(2,3)*SimParam(2,4)*SimParam(2,4)*X(3,i)) / (SimParam(2,1)*SimParam(2,2)*SimParam(2,2))));
	
}

